package com.coder520.commom.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * @Author 高鑫【gx_wanmei@163.com】
 * Created by 2017-6-22.23:55
 */
public class DateUtiles {

    private  static  Calendar calendar  =Calendar.getInstance();

    /**
     *@Author JackGao [gx_wanmei@163.com]
     *@Date 2017-6-23 0:05
     *@Description 得到今天是周几
     */
    public static int  getTodayWeek()
    {

        calendar.setTime(new Date());
        int week =calendar.get(Calendar.DAY_OF_WEEK)-1;
        if (week<0)
        {
            week=7;
        }
        return  week;
    }
    /**
     *@Author JackGao [gx_wanmei@163.com]
     *@Date 2017-6-23 0:06
     *@Description  得到时间差 分钟数
     */
    public static int getMinute(Date startDate, Date endDate)
    {
            long start=startDate.getTime();
            long end=endDate.getTime();
            int minute =(int)(end-start)/(1000*60);
            return  minute;

    }

    public static Date getDate(int hour,int minute)
    {
        calendar.set(Calendar.HOUR_OF_DAY,hour);
        calendar.set(Calendar.MINUTE,minute);
        System.out.println(calendar.getTime());
        return calendar.getTime();
    }

    public static void main(String[] args) {
        getDate(5,30);
    }

}
